/**
 * 
 */
package info.motteke.kurumi.swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

final class TrayMenuListener implements Listener {

    private final Shell parent;

    public TrayMenuListener(Shell parent) {
        this.parent = parent;
    }

    @Override
    public void handleEvent(Event event) {
        MessageBox mbox = new MessageBox(parent, SWT.YES | SWT.NO);
        mbox.setMessage("終了しますか？");

        if(mbox.open() == SWT.YES){
            parent.dispose();
        }
    }
}